import request from '@/utils/request'

// 发送短信验证码
export function sendSmsCode(mobile, scene) {
  return request({
    url: '/weiyi/auth/send-sms-code',
    method: 'post',
    data: {
      mobile,
      scene
    }
  })
}
// 统一登录接口，支持邮箱密码和手机验证码登录（1-邮箱密码登录；2-手机验证码登录）
export function unifiedLogin(loginType,email,password, mobile, code) {
  return request({
    url: '/weiyi/auth/login',
    method: 'post',
    data: {
      loginType,
      email,
      password,
      mobile,
      code
    }
  })
}

// 用户注册 
export function register(
  userType,
  invitationCode,
  mobile,
  email,
  password,
  mobileCode,
  username
) {
  return request({
    url: '/weiyi/auth/register',
    method: 'post',
    data:{
      userType,
      invitationCode,
      mobile,
      email,
      password,
      mobileCode,
      username
    }
  })
}
// 根据邀请码获得详情 
export function getByCode(code) {
  return request({
    url: '/weiyi/invitationcode/get-by-code',
    method: 'get',
    params: {
      code
    }
  })
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: '/weiyi/user/info',
    method: 'get'
  })
}
